{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "bded2d61-25f4-46d0-80b9-d817ef301087",
   "metadata": {},
   "outputs": [],
   "source": [
    "from openai import OpenAI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "430208c0-b4d0-4ae1-8f6e-eb09092af4da",
   "metadata": {},
   "outputs": [],
   "source": [
    "client = OpenAI()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "60c88140-c16c-451f-8791-efcd89238102",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "所有奇数相加等于53。答案为否。\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(\n",
    "  model=\"gpt-3.5-turbo\",\n",
    "  messages=[\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：4、8、9、15、12、2、1，对吗？\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"assistant\",\n",
    "      \"content\": \"所有奇数相加等于25。答案为否。\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：17、10、19、4、8、12、24，对吗？\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"assistant\",\n",
    "      \"content\": \"所有奇数相加等于36。答案为是。\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：15、12、5、3、72、17、1，对吗？\"\n",
    "    },\n",
    "  ]\n",
    ")\n",
    "print(response.choices[0].message.content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f9a90001-ebdb-4aef-824f-1a910598a31f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "所有奇数（15、5、3、17、1）相加，15 + 5 + 3 + 17 + 1 = 41。答案为否。\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(\n",
    "  model=\"gpt-3.5-turbo\",\n",
    "  messages=[\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：4、8、9、15、12、2、1，对吗？\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"assistant\",\n",
    "      \"content\": \"所有奇数（9、15、1）相加，9 + 15 + 1 = 25。答案为否。\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：17、10、19、4、8、12、24，对吗？\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"assistant\",\n",
    "      \"content\": \"所有奇数（17、19）相加，17 + 19 = 36。答案为是。\"\n",
    "    },\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：15、12、5、3、72、17、1，对吗？\"\n",
    "    },\n",
    "  ]\n",
    ")\n",
    "print(response.choices[0].message.content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d9b0e919-e21c-4945-918e-7b7fdff69060",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "是的，让我们来分步骤思考这个问题。\n",
      "\n",
      "首先，我们将奇数从该组中提取出来，这些数字是：15、5、3、17、1。\n",
      "\n",
      "然后，我们将这些奇数相加：15 + 5 + 3 + 17 + 1 = 41。\n",
      "\n",
      "最后，我们检查41这个结果是否为偶数。因为41是奇数，所以该组中的奇数加起来不为偶数。\n",
      "\n",
      "所以，该组中的奇数加起来不为偶数。\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(\n",
    "  model=\"gpt-3.5-turbo\",\n",
    "  messages=[\n",
    "    {\n",
    "      \"role\": \"user\",\n",
    "      \"content\": \"该组中的奇数加起来为偶数：15、12、5、3、72、17、1，对吗？让我们来分步骤思考。\"\n",
    "    },\n",
    "  ]\n",
    ")\n",
    "print(response.choices[0].message.content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fe9363c7-2d0c-4e53-aea5-6fdca584a2d4",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
